/**
 * 通用型组件的组装 增删改查
 */
export const Slime = {
  data() {
    return {
    };
  },
  created() {},
  methods: {
    //获取图片
    imgD(data,num){
      if(data.hot[num-1]){
        if(data.hot[num-1].img){
          return data.hot[num-1].img
        }else{
          return require("@/assets/img/defaultdll.png")
        }
      }else{
        return require("@/assets/img/defaultdll.png")
      }
    },
    //获取id
    idD(data,num){
      if(data.hot[num-1]){
        if(data.hot[num-1].id){
          return data.hot[num-1].id
        }else{
          return 0
        }
      }else{
        return 0
      }
    },
    //获取mode
    modeD(data,num){
      if(data.hot[num-1]){
        if(data.hot[num-1].mode){
          return data.hot[num-1].mode
        }else{
          return 0
        }
      }else{
        return 0
      }
    },
    //跳转详情
    goArticle(id){
      if(id == 0){
        this.$message.warning("并没有对应内容");
      }else{
        this.$router.push({ path: '/article?id='+id})
      }
    },
  },
  filters: {
    //金钱分转元
    money: function (money) {
      if (money == 0) {
        return '0.00'
      } else if (money > 0) {
        return (money / 100).toFixed(2)
      } else {
        return ''
      }
    },
  }
};
